<?php session_start(); ?>
<?php ob_start(); ?> 
<?php
$login=$_SESSION['login'];
if(!isset($login)|| empty($login)){
header('Location:login.php');
}else{
ob_end_flush();
 ?>
<?php
 require_once '../action/DB_MySQL.php';
 $mysql = new DB_MySQL;
 $mysql->connect('localhost', 'baocao', 'root', '');                                             
?>
    <?php include('header.php')?>
    <div id="content">
            <div id="primary">
             <?php if($sanpham="true"){
                   ?>
                      <div id="search">
                        <form action="search.php" method="POST">
                          <p>
                          <input type="text" name="txtsearch" id="search_" value="Tên hoặc giá sản phẩm?"   onblur="if(this.value=='') this.value='Tên hoặc giá sản phẩm?';" onfocus="if(this.value=='Tên hoặc giá sản phẩm?') this.value='';"/>
                          <input type="hidden" name="search_ad" />
                          </p>
                        </form>
                      </div>
                      
                      <?php
                       
                    if(isset($_POST[search_ad])){
                         $txtsearch=$_POST[txtsearch];
                         $mysql->query("select * from sanpham where name like '%{$txtsearch}%' or price='{$txtsearch}' order by id DESC");
                         $kq=$mysql->num_row(); 
                               if($kq==0){
                    ?>
                      <script type="text/javascript">
                         alert("Request Not Found! "); 
                      </script> 
                    <?php
                    }else{
                      
                      include_once("contronler/actionsearch.php");
                   }
                   }
                   }
                   ?>
                
                
            </div>
        </div>
        <?php include('footer.php'); }?>